from datetime import datetime
from typing import Optional
from pydantic import BaseModel

class MessageBase(BaseModel):
    chat_id: str
    sender_id: str
    content: str
    message_type: str  # 'text', 'image', 'voice'

class MessageCreate(MessageBase):
    pass

class MessageUpdate(BaseModel):
    content: Optional[str] = None
    is_read: Optional[bool] = None

class Message(MessageBase):
    id: str
    created_at: datetime
    is_read: bool = False